﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DocumentFormat.OpenXml;
using DocumentFormat.OpenXml.Wordprocessing;
using DocumentFormat.OpenXml.Packaging;
using intelliEssay.Interop.ParagraphStyle;

namespace intelliEssay.Interop
{
    /// <summary>
    /// Queries paragraph property-related information.
    /// </summary>
    public class ParagraphInfoEx
    {
        WordprocessingDocument document;
        Paragraph para;
       HostApplications hostApp = HostApplications.MsOffice2010;
        public ParagraphInfoEx(WordprocessingDocument wd, Paragraph paragraph,HostApplications hostApplication = HostApplications.MsOffice2010)
        {
            document = wd;
            para = paragraph;
            hostApp = hostApplication;
        }
        /// <summary>
        /// This is a short-hand wrapper for calling ParagraphPropertiesHelper.QParagraphPropertiesSingleValueProperty.
        /// </summary>
        /// <param name="name">the name of the property that is in query</param>
        /// <returns>the value of the property.</returns>
        public dynamic this[string propertyName, bool multiValueProperty = false]
        {
            get
            {
                if (multiValueProperty == false)
                {
                    return ParagraphPropertiesHelper.QParagraphPropertiesSingleValueProperty(propertyName, para, document, hostApp);
                }
                else
                {
                    return ParagraphPropertiesHelper.QParagraphPropertiesMultiValueProperty(propertyName, para, document, hostApp);
                }
            }
        }
    }
}
